package edu.sctu;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by 1 on 2018/5/26.
 */
public class EditServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {

        String id = req.getParameter("id");
        int userId = Integer.parseInt(id);

        String username = req.getParameter("username");
        String password = req.getParameter("password");

        System.out.println("--------------"+userId);

        req.setAttribute("john", "编辑成功");
        req.getRequestDispatcher("/userList.jsp").forward(req, resp);
        req.getRequestDispatcher("/userEdit.jsp")
                .forward(req,resp);
    }
}
